﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link rel="Stylesheet" type="text/css" media="screen" href="Screen.css" />
  <title>STP_OnPortEnabled</title>
</head>
<body>
	<h3>STP_OnPortEnabled</h3>
	<hr />
<pre>
void STP_OnPortEnabled
(
    BRIDGE*       bridge,
    unsigned int  portIndex,
    unsigned int  speedMegabitsPerSecond,
    bool          operPointToPointMAC,
    unsigned int  timestamp
);
</pre>
	<h4>
		Summary</h4>
	<p>
		Function which the application must call when 
		the operational state of a port changes to TRUE. See the Remarks 
		section for more details.</p>
	<h4>
		Parameters</h4>
	<dl>
		<dt>bridge</dt>
		<dd>Pointer to a BRIDGE object, obtained from <a href="STP_CreateBridge.html">
			STP_CreateBridge</a>.</dd>
		<dt>portIndex</dt>
		<dd>The index of the port whose operational state has just changed to TRUE.</dd>
		<dt>speedMegabitsPerSecond</dt>
		<dd>The communication speed detected on the port (a value such as 100 for 100 Mbps). This 
			value is used by the STP library to compute path costs.</dd>
		<dt>operPointToPointMAC</dt>
		<dd>The application must pass <code>true</code> when the port was connected to a point-to-point link, or 
			<code>false</code> otherwise. (Eight-wire Ethernet cables are usually point-to-point, coaxial Ethernet 
			cables are usually not.)</dd>
		<dt>timestamp</dt>
		<dd>A timestamp used for the debug log. </dd>
	</dl>
	<h4>
		Remarks</h4>
		<p>
			See §6.6.2 and §6.6.3 in the 802.1Q-2011 Specification for more information.</p>
	<p>
		The application can usually detect changes in the operational state of a port by polling 
		an internal register of the PHY of a physical port. Refer to the manual of the bridge IC 
		for specific details on how to do this.</p>
	The current library code was 
	only tested with eight-wire cables (so <code>operPointToPointMAC</code> always true).<p>
		The current version of the library ignores the <code>speedMegabitsPerSecond</code> parameter and uses a 
		constant value of 200000 for port path costs. Anyway, it is recommended that
		the application passes the correct value in this parameter, because the STP library will 
		eventually implement calculation of the port path cost.</p>
	<p>
			Execution of this function is a potentially lengthy process. 
			It may call various callbacks multiple times.</p>
	<p>
			The application must not call this function for already enabled ports (i.e., must not call 
			it twice in a row). For convenience, the <a href="STP_GetPortEnabled.html">STP_GetPortEnabled</a> 
			is provided, which the application can use to check whether it had previously enabled or 
			disabled a port.</p>
	<p>
			This function <strong>may not</strong> be called from within an <a href="STP_CALLBACKS.html">STP callback</a>.</p>

</body>
</html>
